brushless28 2.2.0
Loading...
Searching...
No Matches
brushless28


Brushless 28 Click

Brushless 28 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Feb 2026.
  • Type : SPI type

Software Support

Example Description

This example demonstrates the use of the Brushless 28 Click board by driving the motor in both directions at different speeds.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Brushless28

Example Key Functions

Application Init

Initializes the driver and performs the Click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
brushless28_cfg_t brushless28_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
brushless28_cfg_setup( &brushless28_cfg );
if ( BRUSHLESS28_OK != brushless28_init( &brushless28, &brushless28_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( BRUSHLESS28_OK != brushless28_default_cfg ( &brushless28 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ BRUSHLESS28_OK
Definition brushless28.h:293
#define BRUSHLESS28_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition brushless28.h:224
void application_init(void)
Definition main.c:34
#define MIKROBUS_POSITION_BRUSHLESS28
Definition main.c:28

Application Task

Controls the motor speed by changing the PWM duty cycle every 500 milliseconds. The duty cycle ranges from 0% to 100%. At the minimal speed, the motor switches direction. Each step will be logged on the USB UART where you can track the program flow.

void application_task ( void )
{
static int8_t duty_cnt = 0;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
brushless28_set_duty_cycle ( &brushless28, duty );
log_printf( &logger, "> Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
Delay_ms ( 500 );
duty_cnt += duty_inc;
if ( duty_cnt > 10 )
{
duty_cnt = 9;
duty_inc = -1;
}
else if ( duty_cnt < 0 )
{
duty_cnt = 1;
duty_inc = 1;
log_printf( &logger, " Pull brake\r\n" );
brushless28_pull_brake ( &brushless28 );
Delay_ms ( 1000 );
log_printf( &logger, " Switch direction\r\n" );
brushless28_switch_direction ( &brushless28 );
Delay_ms ( 1000 );
log_printf( &logger, " Release brake\r\n" );
brushless28_release_brake ( &brushless28 );
Delay_ms ( 1000 );
}
}
void brushless28_pull_brake(brushless28_t *ctx)
Brushless 28 pull brake function.
void application_task(void)
Definition main.c:70

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.